package com.heima.minio.test;

import com.heima.file.service.FileStorageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
@SpringBootTest
@RunWith(SpringRunner.class)
public class MinioTest2 {
    @Autowired
    private FileStorageService storageService;

    @Test
    public void testUpload() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("D:\\list.html");
        String path = storageService.uploadHtmlFile("", "list.html", fileInputStream);
        System.out.println(path);
    }

    @Test
    public void testDelete(){
        storageService.delete("http://1.12.59.44:9090/leadnews/2022/08/28/list.html");
    }
}
